package com.wcity.manage.dao.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;

/**
 * Created by jn on 2016/12/12.
 * 更改绑定手机号验证dao
 */
@Repository
public interface BindVerifyMapper {

    /**
     * 插入
     * @param uuid
     * @param registerId
     * @return
     */
    @Insert(" insert into td_bind_verify(uuid,register_id,create_time) values(#{uuid},#{registerId},NOW()) ")
    int insert(@Param("uuid")String uuid,@Param("registerId")int registerId);

    /**
     * 获取过期时间
     * @param uuid
     * @param registerId
     * @return
     */
    @Select(" select create_time from td_bind_verify where register_id = #{registerId} and uuid = #{uuid} ")
    Date getExpireTime(@Param("uuid")String uuid,@Param("registerId")int registerId);

    /**
     * 删除uuid
     * @param registerId
     * @return
     */
    @Delete(" delete from td_bind_verify where register_id = #{registerId} ")
    int deleteByRegisterId(int registerId);
}
